import type {
  EasyTableProps,
  TableColumns,
  PaginationProps
} from '@/components/table'
import type { FieldListItem } from '@/components/form'
import type { RowProps } from 'element-plus'

interface EasyProTableProps extends EasyTableProps {}

type EasyProTableColumn =
  | TableColumns
  | (FieldListItem & {
      search?: boolean
    })

type EasyRowProps = {
  gutter?: number | RowProps['gutter']
  justify?: RowProps['justify']
  align?: RowProps['align']
  tag?: RowProps['tag']
}

/**
 * @description 该配置用于配置pro table的整体配置
 * 其中 RowProps、ColProps、FormProps来自element-plus
 * 具体配置项参考element-plus的文档
 * @see {@link https://element-plus.org/zh-CN/component/overview.html}
 */
interface EasyProTableOptions extends EasyRowProps {
  /** 配置search区域的布局 */
  searchLayout?: {
    span?: number
    gutter?: number
  }
  /** 配置search区域的搜索按钮文本 */
  searchBtnText?: string
  /** 配置search区域的重置按钮文本 */
  resetBtnText?: string
  /** 配置table的高度 */
  tableHeight?: string
}

type EasyProTableToolbar =
  | boolean
  | {
      title: string | Element
    }

export type {
  EasyProTableProps,
  EasyProTableColumn,
  PaginationProps,
  EasyProTableOptions,
  EasyProTableToolbar
}
